Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mute-stream

Package Overview
Dependencies
Maintainers
4
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mute-stream

Bytes go in, but they don't come out (when muted).

  • 0.0.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6M
decreased by-80.3%
Maintainers
4
Weekly downloads
 
Created

What is mute-stream?

The mute-stream package is a Node.js module that allows you to mute and unmute writable streams, such as process.stdout or any other stream. This can be particularly useful for hiding user input during password prompts or suppressing output for clean logging.

What are mute-stream's main functionalities?

Muting and unmuting a stream

This feature allows you to mute the output of a stream so that data written to it does not appear on the terminal or the piped destination. You can then unmute the stream to resume normal output.

const MuteStream = require('mute-stream');
const ms = new MuteStream();

ms.pipe(process.stdout);
ms.write('This will be displayed.');
ms.mute();
ms.write('This will not be displayed.');
ms.unmute();
ms.write('This will be displayed again.');

Muting and unmuting with a boolean

This feature provides an alternative way to mute and unmute the stream by passing a boolean value to the mute method.

const MuteStream = require('mute-stream');
const ms = new MuteStream();

ms.pipe(process.stdout);
ms.mute(true);
ms.write('This will not be displayed.');
ms.mute(false);
ms.write('This will be displayed.');

Setting up a prompt with muted input

This feature is useful for creating command-line prompts where you want to hide the user's input, such as password fields.

const MuteStream = require('mute-stream');
const readline = require('readline');

const ms = new MuteStream();
ms.pipe(process.stdout);

const rl = readline.createInterface({
  input: process.stdin,
  output: ms
});

rl.question('Enter your password: ', (password) => {
  ms.mute();
  console.log(`Your password is: ${password}`);
  rl.close();
});

Other packages similar to mute-stream

Keywords

FAQs

Package last updated on 03 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc